home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-10-12 | 2.1 KB | 95 lines | [TEXT/ttxt] |
- #!/bin/sh
- #
- # Install an alternative system nib file on Mac OS X Public Beta
- # script by Mike Elston <mde@mac.com> 2000/10/12
- #
-
- # English ScreenSaver preference - new nib file implementing screenlocking
- # nib file (c) 2000 Apple Computer, Inc
- # modified by Mike Elston <mde@mac.com> 2000/10/11
-
- DEST1=/System/Library/Preferences/ScreenSaver.preference
- DEST2=Contents/Resources/English.lproj
- NIB=ScreenSaverPref.nib
- SAVE=ScreenSaverPref_orig.nib
- APPNAME="System Preferences"
- APP="System Pref"
-
- case $1 in
- -f) force=yes; shift;;
- esac
-
- PATH=/bin:/sbin:/usr/sbin:/usr/bin export PATH
- err=0
- logfile="$0.log"
- rm -f $logfile 2>/dev/null
- > $logfile
- tail -f $logfile &
- tailpid=$!
- trap "exec >/dev/null 2>&1; sleep 1; kill -HUP $tailpid; exit \$err" 0
- exec >$logfile 2>&1
-
- # set -x
-
- [ `id -u` = 0 ] || {
- echo "You must be the super-user (root) to make this installation"
- err=1; exit $err
- }
- [ -d ./$NIB ] || {
- cd `expr $0 : '\(.*/\)'` 2>&1
- [ -d ./$NIB ]
- } || {
- echo "install: cannot find $NIB to install"
- err=1; exit $err
- }
- [ -d $DEST1 ] || {
- echo "install: cannot find $DEST1"
- err=1; exit $err
- }
- [ -d $DEST1/$DEST2 ] || {
- echo "You do not appear to have installed the English language version of" `basename $DEST1`
- err=1; exit $err
- }
-
- # check whether app is running
-
- pid=`ps aux|grep "$APP"|awk '{print $2}'`
- [ "$pid" ] && {
- [ "$force" ] || {
- echo "You should quit $APPNAME before installing"
- err=1; exit $err
- }
- echo "... shutting down $APPNAME..."
- kill -HUP $pid 2>&1
- sleep 1 # wait a sec
- [ `ps aux|grep "$APP"|awk '{print $2}'` ] && {
- echo "... failed"
- echo "You should quit $APPNAME before installing"
- err=1; exit $err
- }
- }
-
- # OK, now we can install
-
- [ -d $DEST1/$DEST2/$NIB ] && {
- if [ -d $DEST1/$DEST2/$SAVE ]
- then
- rm -r $DEST1/$DEST2/$NIB 2>&1 || {
- err=1; exit $err
- }
- else
- echo "... saving original nib file"
- mv $DEST1/$DEST2/$NIB $DEST1/$DEST2/$SAVE 2>&1 || {
- err=1; exit $err
- }
- fi
- }
-
- mv ./$NIB $DEST1/$DEST2/ 2>&1 || {
- err=1; exit $err
- }
- chown -R 0:0 $DEST1/$DEST2/$NIB 2>&1
- chmod -R u=rwX,go=rX $DEST1/$DEST2/$NIB 2>&1
-
- echo "Installation of $NIB successful!"
-